import request from '@/utils/request';

export const getArticlesByIdAPI = (channel_id: number, timestamp = Date.now()) => {
  return request({
    url: '/v1_0/articles',
    params: {
      channel_id,
      timestamp,
    },
  });
};

export const getArticleDetailByIdAPI = (article_id: string) => {
  return request({
    url: '/v1_0/articles/' + article_id,
  });
};

export const likeArticleAPI = (data: { target: string }) => {
  return request({ url: '/v1_0/article/likings', method: 'post', data });
};

export const dislikeArticleAPI = (target: string) => {
  return request({ url: '/v1_0/article/likings/' + target, method: 'delete' });
};

export const collectArticleAPI = (target: string) => {
  return request({ url: '/v1_0/article/collections', method: 'post', data: { target } });
};

export const discollectArticleAPI = (target: string) => {
  return request({ url: '/v1_0/article/collections/' + target, method: 'delete' });
};
